import { createApp } from "vue"
import App from "./App.vue"
import router from "./router"
import store from './store'

import "@/styles/index.scss"
import 'uno.css'
import 'nprogress/nprogress.css'

import "element-plus/theme-chalk/src/message.scss"
import "element-plus/theme-chalk/src/notification.scss"

const app = createApp(App)
app.use(router).use(store).mount("#app")

const vClickOutside = {
  beforeMount(el: any, binding: any) {
    el.clickOutsideEvent = function(event: Event) {
      if (!(el === event.target || el.contains(event.target))) {
        binding.value(event)
      }
    }
    document.addEventListener('click', el.clickOutsideEvent)
  },
  unmounted(el: any) {
    document.removeEventListener('click', el.clickOutsideEvent)
  }
}

app.directive('click-outside', vClickOutside)
